<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function myAsyncFunction(url) {
            return new Promise((resolve, reject) => {
                //异步任务
                const xhr = new XMLHttpRequest();
                xhr.open('Get', url);
                xhr.onload = () => resolve(JSON.parse(xhr.response));
                xhr.onerror = () => reject(xhr, statusText);
                xhr.send();
            })
        }
        let a = myAsyncFunction('https://api.apiopen.top/todayVideo')
        a.then(
            value => console.log('onResloved', value),
            reason => console.log('onReject', reason),
        )
    </script>
</body>

</html>